import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
@Injectable({
  providedIn: 'root'
})
export class ShareMessageService {
private msg = new Subject<any>();
private modelISVisible = new Subject<any>();
constructor() { }
 // 发送消息
    sendMessage(message: string) {
      this.msg.next(message);
    }
    // 清除消息
    clearMessage() {
      this.msg.next();
    }
    // 获取消息
    getMessage(): Observable<any> {
      return this.msg.asObservable();
    }
    sendModel(message: boolean) {
      this.modelISVisible.next(message);
    }
    // 清除消息
    clearModel() {
      this.modelISVisible.next();
    }
    // 获取消息
    getModel(): Observable<any> {
      return this.modelISVisible.asObservable();
    }

}
